import request from '@/utils/request'

// 获取部门的列表
export const getDepartments = () => {
  return request.get('/company/department')
}

export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

export function getDepartmentSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

export function updateDepartmentDetail(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
// 删除子部门
/**
* @desription :删除部门
* @param { * } id 点击按钮当前项的id
* @returns {*}
*/
export function deleteDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
